package com.lagou.service;

import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

import java.util.HashMap;
import java.util.Map;

/**
 * @ClassName: PayOrderService
 * @Description:
 * @Author: qjc
 * @Date: 2021/12/9 6:07 下午
 */
@Service
public class PayOrderService {
    // 模拟数据库
    private Map<String, String> orderMap = new HashMap<>();

    public void updateOrderStatus(String orderNo, String orderStatus) {
        String order = orderMap.get(orderNo);
        orderMap.put(orderNo, orderStatus);
        if (StringUtils.isEmpty(order)) {
            System.out.println("创建订单成功，订单编号为：" + orderNo + "，订单初始状态为：" + orderStatus);
        } else {
            System.out.println("修改订单：" + orderNo + "状态为：" + orderStatus);
        }
        System.out.println("====================================================");
    }

    public String getOrderStatus(String orderNo) {
        return orderMap.get(orderNo);
    }

}
